package com.zhujiaji.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhujiaji.mapper.BookMapper;
import com.zhujiaji.pojo.Book;
import com.zhujiaji.service.BookService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 朱佳吉
 * @date 2024/3/16 16:41
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements BookService{

    @Override
    public List<Book> listAll() {
        List<Book> bookList = baseMapper.selectList(null);
        return bookList;
    }

    @Override
    public boolean removeBookById(Integer id) {
        int count = baseMapper.deleteBookById(id);
        if (count > 0) {
            return true;
        }
        return false;
    }
}
